package program;

import hexgame.HexGame;
import hexgame.HexGameRequest;

import java.net.UnknownHostException;

import network.HexNetwork;
import network.NetworkPartialClientException;
import ai.basic.RandomAIFactory;
import ai.complex_path_finding.AStarAIFactory;
import ai.minimax.MiniMaxAIFactory;

public class TestingAI {
	
	public static void main(String[] args) {
		GameManager games = new GameManager();
		
		for(int i=0; i<10; i++) {
			HexGameRequest request;
			try {
				request = HexNetwork.connectTo("localhost", 7600, 5, i%2 == 0);
			}
			catch (UnknownHostException e) {
				System.out.println("Error");
				return;
			}
			catch (NetworkPartialClientException e) {
				System.out.println("Error");
				return;
			}
			
			request.setLocalPlayerFactory(new MiniMaxAIFactory(5, true));
			HexGame game = new HexGame(request);
			game.startGame();
			GameManager.addGame(game);
		}
		
		System.out.println("number of games won: " + games.numGamesWon());
	}

}
